# import time  # 正确的导入方式，导入标准time模块
# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# # 直接在初始化Chrome时指定驱动路径
# driver = webdriver.Chrome(executable_path=r"D:\python\chromedriver.exe")
# driver.get("http://121.43.169.97:8848/pageA.html")
# driver.find_element(By.XPATH, "//input[@name='userA']").send_keys("admin")
# driver.find_element(By.XPATH, "//input[@id='passwordA']").send_keys("123456")
# driver.find_element(By.XPATH, "//input[@type='button' and @value='prompt']")
# time.sleep(2)  # 现在可以正确调用sleep()方法了
# driver.quit()


# import time
# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# driver = webdriver.Chrome(executable_path=r"D:\python\chromedriver.exe")
# driver.get("http://121.43.169.97:8848/pageA.html")
# driver.find_element(By.XPATH, "//*[text()='百度']").click()
# time.sleep(2)
# driver.quit()


import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("http://121.43.169.97:8848/pageA.html")
driver.maximize_window()
time.sleep(1)
driver.find_element(By.XPATH, "//*[contains(@placeholder,'用户名')]").send_keys("admin")
time.sleep(3)
driver.find_element(By.XPATH, "//*[text()='百度']").click()
time.sleep(3)
driver.quit()
